<!DOCTYPE html>
<html>
<head>
    <title>后台管理中心</title>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <link href="${ctxPath}/assets/login/css/style.css" rel="stylesheet" type="text/css" />
    <link href="${ctxPath}/assets/login/css/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />

    <link rel="stylesheet" type="text/css" href="${ctxPath}/assets/login/css/styles1.css" title="styles1" media="screen" >
    <link rel="alternate stylesheet" type="text/css" href="${ctxPath}/assets/login/css/styles2.css" title="styles2" media="screen" >
    <link rel="alternate stylesheet" type="text/css" href="${ctxPath}/assets/login/css/styles3.css" title="styles3" media="screen" >

    <link rel="stylesheet" href="${ctxPath}/assets/common/libs/layui/css/layui.css?v=${constants.getReleaseVersion()}">
    <link rel="stylesheet" href="${ctxPath}/assets/common/css/login.css?v=${constants.getReleaseVersion()}" media="all">



    <script type="text/javascript" src="${ctxPath}/assets/login/js/jquery.min.js"></script>
    <script type="text/javascript" src="${ctxPath}/assets/login/js/styleswitch.js"></script>
    <script type="text/javascript" src="${ctxPath}/assets/login/css/Particleground.js"></script>
    <style type="text/css">html,body{height: 100%;position: relative;}</style>
    <script>
        $(document).ready(function() {
            $('body').particleground({
                dotColor: 'rgba(255,255,255,0.2)',
                lineColor: 'rgba(255,255,255,0.2)'
            });
        });
    </script>
    <script>
        if (window != top)
            top.location.replace(location.href);
    </script>
</head>
<body onload="javascript:document.myform.username.focus();" id="canvas">

<div class="admin_login">


    <div  class="layui-card-body layui-form layui-form-pane" lay-filter="loginForm" style="padding: 0px;">


        <div class="admin_title">
            <strong> ${constants.getSystemName()}</strong>
            <em>Management System</em>
        </div>


              @if(constants.getTenantOpen()){
                <div class="layui-form-item">
                    <label class="layui-form-label">租户</label>
                    <div class="layui-input-block">
                        <select name="tenantCode" id="tenantCode">
                            <option value="">默认租户</option>
                        </select>
                    </div>
                </div>
                @}

        <div class="layui-form-item">
            <label class="layui-form-label" style="width: 48px;"><i class="layui-icon layui-icon-username"></i></label>
            <div class="layui-input-block" style="margin-left: 48px;" >
                <input name="username" id="username" type="text" placeholder="账号" lay-verify="required" class="layui-input"  >
            </div>
        </div>


        <div class="layui-form-item">
            <label class="layui-form-label" style="width: 48px;"><i class="layui-icon layui-icon-password"></i></label>
            <div class="layui-input-block" style="margin-left: 48px;" >
                <input name="password" type="password" id="password" placeholder="密码" lay-verify="required" class="layui-input">
            </div>
        </div>
         @if(constants.getKaptchaOpen()){
        <div class="layui-form-item" style="height: 38px;">
            <label class="layui-form-label" style="width: 48px;"><i class="layui-icon layui-icon-vercode"></i></label>
            <div class="layui-input-block" style="margin-left: 48px;">
                <div class="layui-row inline-block">
                    <div class="layui-col-xs7">
                        <input name="kaptcha" id="kaptcha" type="text" lay-verify="required" placeholder="验证码"
                               class="layui-input">
                    </div>
                    <div class="layui-col-xs5" style="padding-left: 10px;">
                        <img class="login-captcha" src="/kaptcha" style="height: 38px;">
                    </div>
                </div>
            </div>
        </div>
        @}


        <div class="layui-form-item" pane="">
            <label class="layui-form-label" lay-tips="7天内免登陆" style="width: 80px;">记住我</label>
            <div class="layui-input-block">
                <input type="radio" name="remember" value="on" title="是">
                <input type="radio" name="remember" value="off" title="否" checked="">
            </div>
        </div>


    <!--     <div class="admin_sub">
            <input type="submit" lay-filter="login-submit" lay-submit value="立即登陆" class="submit_btn">
        </div> -->
		
		 <div class="layui-form-item">
                    <button class="layui-btn layui-btn-fluid" id="submit">登 录</button>
         </div>
		
	<!-- 	
	<div class="layui-form-item login-other">
                    <label>第三方登录</label>
                    <a href="${ctxPath}/oauth/render/qq"><i class="layui-icon layui-icon-login-qq"></i></a>
                    <a href="${ctxPath}/oauth/render/gitee"><img style="height: 28px;width: 28px" src="${ctxPath}/assets/expand/images/git.png"></a>
                </div> 
				-->
		
        <div class="admin_info">
            <p>© 2020-2022 <a target="_bank" href="" style="color:#2f4050">${constants.getSystemName()} </a></p>
            <p>赣ICP备2022000957号</p>
        </div>
    </div>


</div>

@/* 加入contextPath属性和session超时的配置 */
<script type="text/javascript">
    var Feng = {
        ctxPath: "${ctxPath}",
        version: '${constants.getReleaseVersion()}'
    };
</script>
<script type="text/javascript" src="${ctxPath}/assets/common/libs/layui/layui.js?v=${constants.getReleaseVersion()}"></script>
<script type="text/javascript" src="${ctxPath}/assets/common/js/common.js?v=${constants.getReleaseVersion()}"></script>

<script>
    layui.use(['layer', 'form', 'index', 'ax'], function () {
        var $ = layui.jquery;
        var $ax = layui.ax;
        var layer = layui.layer;
        var form = layui.form;
        var index = layui.index;

        // 图形验证码
        $('.login-captcha').click(function () {
            this.src = this.src + '?t=' + (new Date).getTime();
        });

        var errorMsg = "${tips!}";
        if (errorMsg) {
            layer.msg(errorMsg, {icon: 5, anim: 6});
        }

        @if(constants.getTenantOpen()){
            //初始化租户列表
            var ajax = new $ax(Feng.ctxPath + "/tenantInfo/listTenants", function (data) {
                for (var i = 0; i < data.data.length; i++) {
                    var name = data.data[i].name;
                    var code = data.data[i].code;
                    $("#tenantCode").append('<option value="' + code + '">' + name + '</option>');
                }
                form.render();
            }, function (data) {
            });
            ajax.start();
        @}

        //登录操作
        $('#submit').click(function () {
            var ajax = new $ax(Feng.ctxPath + "/login", function (data) {
                Feng.success("登录成功!");
                index.clearTabCache();
                window.location.href = Feng.ctxPath + "/";
            }, function (data) {
                layer.msg("登录失败！" + data.message, {icon: 5, anim: 6});
            });
            ajax.set("username", $("#username").val());
            ajax.set("password", $("#password").val());
            @if(constants.getTenantOpen()){
                ajax.set("tenantCode", $("#tenantCode").val());
            @}
            @if(constants.getKaptchaOpen()){
                ajax.set("kaptcha", $("#kaptcha").val());
            @}
            ajax.start();
        });

    });
</script>


</body>
</html>
                